﻿USE [ncc-sop]
GO
/****** Object:  Table [dbo].[MetadataDPMTableAttributes]    Script Date: 02/12/2014 11:35:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MetadataDPMTableAttributes](
	[TableAttributeId] [int] IDENTITY(1,1) NOT NULL,
	[rptAttributeName] [varchar](255) NOT NULL,
	[rptAttributeDescription] [varchar](1000) NULL,
 CONSTRAINT [PK_MetadataDPMTableAttributes] PRIMARY KEY CLUSTERED 
(
	[TableAttributeId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[MetadataDPMTableAttributes] ON
INSERT [dbo].[MetadataDPMTableAttributes] ([TableAttributeId], [rptAttributeName], [rptAttributeDescription]) VALUES (1, N'Statistic Type', N'')
INSERT [dbo].[MetadataDPMTableAttributes] ([TableAttributeId], [rptAttributeName], [rptAttributeDescription]) VALUES (2, N'Aggregate Type', N'')
INSERT [dbo].[MetadataDPMTableAttributes] ([TableAttributeId], [rptAttributeName], [rptAttributeDescription]) VALUES (3, N'Admission Type', N'')
SET IDENTITY_INSERT [dbo].[MetadataDPMTableAttributes] OFF
/****** Object:  Table [dbo].[MetadataDPMTables]    Script Date: 02/12/2014 11:35:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MetadataDPMTables](
	[TableId] [int] IDENTITY(1,1) NOT NULL,
	[rptName] [varchar](255) NOT NULL,
	[rptDescription] [varchar](1000) NULL,
	[rptLabel] [varchar](255) NULL,
	[createdBy] [nchar](100) NULL,
	[createdOn] [datetime] NULL,
	[updatedBy] [nchar](100) NULL,
	[updatedOn] [datetime] NULL,
	[status] [nchar](10) NULL,
	[fileName] [nchar](500) NULL,
	[isRpt] [smallint] NULL,
	[categories] [nchar](20) NULL,
 CONSTRAINT [PK_MetadataDPMTables] PRIMARY KEY CLUSTERED 
(
	[TableId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[MetadataDPMTables] ON
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (1, N'No of new referrals (inpatient)', N'', N'No of new referrals (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (2, N'No of reviews (inpatient)', N'', N'No of reviews (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (3, N'Total number of visits (inpatient)', N'', N'Total number of visits (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (4, N'No of inpatients seen within 2 working days of 1st referral (blue letter)= Date of 1st seen by DPM - date of 1st referral (blue letter)', N'', N'No of inpatients seen within 2 working days of 1st referral (blue letter)= Date of 1st seen by DPM - date of 1st referral (blue letter)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (5, N'No of new referrals (SOC)', N'', N'No of new referrals (SOC)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (6, N'No of reviews (SOC)', N'', N'No of reviews (SOC)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (7, N'Breakdown of departments for referral (inpatient)', N'', N'Breakdown of departments for referral (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (8, N'Breakdown of principal diagnosis (inpatient)', N'', N'Breakdown of principal diagnosis (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (9, N'Breakdown of reasons for referral to DPM (inpatient)', N'', N'Breakdown of reasons for referral to DPM (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (10, N'Breakdown of reasons for non attendance at SOC', N'', N'Breakdown of reasons for non attendance at SOC', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (11, N'Breakdown of principal diagnosis (SOC)', N'', N'Breakdown of principal diagnosis (SOC)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (12, N'Breakdown of consults by consultants (SOC)', N'', N'Breakdown of consults by consultants (SOC)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (13, N'No of new referrals (inpatient)', N'', N'No of new referrals (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (14, N'No of reviews (inpatient)', N'', N'No of reviews (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (15, N'No of new referrals (SOC)', N'', N'No of new referrals (SOC)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (16, N'No of reviews (SOC)', N'', N'No of reviews (SOC)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (17, N'Total number of deaths', N'', N'Total number of deaths', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (18, N'Breakdown of place of deaths', N'', N'Breakdown of place of deaths', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (19, N'Duration under palliative care = date of death - date of 1st referral to palliative care', N'', N'Duration under palliative care = date of death - date of 1st referral to palliative care', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (20, N'No of new referrals (inpatient)', N'', N'No of new referrals (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (21, N'No of reviews (inpatient)', N'', N'No of reviews (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (22, N'Total number of visits (inpatient)', N'', N'Total number of visits (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (23, N'No of referrals from ICU ', N'', N'No of referrals from ICU ', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (24, N'No of new referrals (SOC)', N'', N'No of new referrals (SOC)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (25, N'No of reviews (SOC)', N'', N'No of reviews (SOC)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (26, N'No of inpatients seen within 2 working days of 1st referral (blue letter)= Date of 1st seen by DPM - date of 1st referral (blue letter)', N'', N'No of inpatients seen within 2 working days of 1st referral (blue letter)= Date of 1st seen by DPM - date of 1st referral (blue letter)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (27, N'Breakdown of different cancers at 1st referral  (pls see attached list) (inpatients)', N'', N'Breakdown of different cancers at 1st referral  (pls see attached list) (inpatients)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (28, N'Breakdown of reasons for referral to DPM (inpatient)', N'', N'Breakdown of reasons for referral to DPM (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (29, N'Breakdown of reasons for non attendance at SOC', N'', N'Breakdown of reasons for non attendance at SOC', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (30, N'Breakdown of different cancers at 1st consult (SOC)', N'', N'Breakdown of different cancers at 1st consult (SOC)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (31, N'No of new referrals (inpatient)', N'', N'No of new referrals (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (32, N'No of reviews (inpatient)', N'', N'No of reviews (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (33, N'Total number of visits (inpatient)', N'', N'Total number of visits (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (34, N'No of referrals from ICU ', N'', N'No of referrals from ICU ', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (35, N'No of new referrals (SOC)', N'', N'No of new referrals (SOC)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (36, N'No of reviews (SOC)', N'', N'No of reviews (SOC)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (37, N'No of inpatients seen within 2 working days of 1st referral (blue letter)= Date of 1st seen by DPM - date of 1st referral (blue letter)', N'', N'No of inpatients seen within 2 working days of 1st referral (blue letter)= Date of 1st seen by DPM - date of 1st referral (blue letter)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (38, N'Breakdown of different cancers at 1st referral  (pls see attached list) (inpatients)', N'', N'Breakdown of different cancers at 1st referral  (pls see attached list) (inpatients)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (39, N'Breakdown of reasons for referral to DPM (inpatient)', N'', N'Breakdown of reasons for referral to DPM (inpatient)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (40, N'Breakdown of reasons for non attendance at SOC', N'', N'Breakdown of reasons for non attendance at SOC', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (41, N'Breakdown of different cancers at 1st consult (SOC)', N'', N'Breakdown of different cancers at 1st consult (SOC)', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ', 0, N'rpt                 ')
INSERT [dbo].[MetadataDPMTables] ([TableId], [rptName], [rptDescription], [rptLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName], [isRpt], [categories]) VALUES (42, N'test', N'url test', N'url test', N'admin                                                                                               ', CAST(0x0000A2A600000000 AS DateTime), NULL, NULL, N'Active    ', N'/default.aspx                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ', 0, N'rpt                 ')
SET IDENTITY_INSERT [dbo].[MetadataDPMTables] OFF
/****** Object:  Table [dbo].[MetadataDPMTableAttributeValues]    Script Date: 02/12/2014 11:35:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MetadataDPMTableAttributeValues](
	[TableId] [int] NOT NULL,
	[TableAttributeId] [int] NOT NULL,
	[TableAttributeValueId] [int] IDENTITY(1,1) NOT NULL,
	[TableAttributeValue] [varchar](255) NOT NULL,
 CONSTRAINT [PK_MetadataDPMTableAttributeValues] PRIMARY KEY CLUSTERED 
(
	[TableAttributeValueId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[MetadataDPMTableAttributeValues] ON
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (1, 1, 124, N'Standard DPM statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (1, 2, 125, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (1, 3, 126, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (2, 1, 127, N'Standard DPM statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (2, 2, 128, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (2, 3, 129, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (3, 1, 130, N'Standard DPM statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (3, 2, 131, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (3, 3, 132, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (4, 1, 133, N'Standard DPM statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (4, 2, 134, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (4, 3, 135, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (5, 1, 136, N'Standard DPM statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (5, 2, 137, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (5, 3, 138, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (6, 1, 139, N'Standard DPM statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (6, 2, 140, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (6, 3, 141, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (7, 1, 142, N'Standard DPM statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (7, 2, 143, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (7, 3, 144, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (8, 1, 145, N'Standard DPM statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (8, 2, 146, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (8, 3, 147, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (9, 1, 148, N'Standard DPM statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (9, 2, 149, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (9, 3, 150, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (10, 1, 151, N'Standard DPM statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (10, 2, 152, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (10, 3, 153, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (11, 1, 154, N'Standard DPM statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (11, 2, 155, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (11, 3, 156, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (12, 1, 157, N'Standard DPM statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (12, 2, 158, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (12, 3, 159, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (13, 1, 160, N'SHC statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (13, 3, 161, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (14, 1, 162, N'SHC statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (14, 3, 163, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (15, 1, 164, N'SHC statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (15, 3, 165, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (16, 1, 166, N'SHC statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (16, 3, 167, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (17, 1, 168, N'Death statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (18, 1, 169, N'Death statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (19, 1, 170, N'Death statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (20, 1, 171, N'Cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (20, 2, 172, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (20, 3, 173, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (21, 1, 174, N'Cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (21, 2, 175, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (21, 3, 176, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (22, 1, 177, N'Cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (22, 2, 178, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (22, 3, 179, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (23, 1, 180, N'Cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (23, 2, 181, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (23, 3, 182, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (24, 1, 183, N'Cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (24, 2, 184, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (24, 3, 185, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (25, 1, 186, N'Cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (25, 2, 187, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (25, 3, 188, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (26, 1, 189, N'Cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (26, 2, 190, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (26, 3, 191, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (27, 1, 192, N'Cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (27, 2, 193, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (27, 3, 194, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (28, 1, 195, N'Cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (28, 2, 196, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (28, 3, 197, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (29, 1, 198, N'Cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (29, 2, 199, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (29, 3, 200, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (30, 1, 201, N'Cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (30, 2, 202, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (30, 3, 203, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (31, 1, 204, N'Non cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (31, 2, 205, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (31, 3, 206, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (32, 1, 207, N'Non cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (32, 2, 208, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (32, 3, 209, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (33, 1, 210, N'Non cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (33, 2, 211, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (33, 3, 212, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (34, 1, 213, N'Non cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (34, 2, 214, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (34, 3, 215, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (35, 1, 216, N'Non cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (35, 2, 217, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (35, 3, 218, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (36, 1, 219, N'Non cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (36, 2, 220, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (36, 3, 221, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (37, 1, 222, N'Non cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (37, 2, 223, N'patient count')
GO
print 'Processed 100 total records'
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (37, 3, 224, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (38, 1, 225, N'Non cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (38, 2, 226, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (38, 3, 227, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (39, 1, 228, N'Non cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (39, 2, 229, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (39, 3, 230, N'in-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (40, 1, 231, N'Non cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (40, 2, 232, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (40, 3, 233, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (41, 1, 234, N'Non cancer statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (41, 2, 235, N'Breakdown')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (41, 3, 236, N'out-patients')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (42, 1, 237, N'Standard DPM statistics')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (42, 2, 238, N'patient count')
INSERT [dbo].[MetadataDPMTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (42, 3, 239, N'in-patients')
SET IDENTITY_INSERT [dbo].[MetadataDPMTableAttributeValues] OFF
/****** Object:  StoredProcedure [dbo].[getLVL2TableID3]    Script Date: 02/12/2014 11:35:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[getLVL2TableID3]
	-- Add the parameters for the stored procedure here
	@statsType varchar(30), @admissionType varchar(30)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	select distinct tableID  from MetadataDPMTableAttributeValues 
	where TableId in ( 
		select distinct TableId from MetadataDPMTableAttributeValues 
		where TableId in (
			select MetadataDPMTables.TableId from 
			MetadataDPMTables inner join MetadataDPMTableAttributeValues on MetadataDPMTables.TableId = MetadataDPMTableAttributeValues.TableId 
			where TableAttributeId = 1 and TableAttributeValue=@statsType
			) 
		) 
	and TableAttributeId = 3 and TableAttributeValue = @admissionType
END
GO
/****** Object:  StoredProcedure [dbo].[getLVL2TableID2]    Script Date: 02/12/2014 11:35:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[getLVL2TableID2]
	-- Add the parameters for the stored procedure here
	@statsType varchar(30)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	select distinct TableId from MetadataDPMTableAttributeValues 
		where TableId in (
			select MetadataDPMTables.TableId from 
			MetadataDPMTables inner join MetadataDPMTableAttributeValues on MetadataDPMTables.TableId = MetadataDPMTableAttributeValues.TableId 
			where TableAttributeId = 1 and TableAttributeValue=@statsType
			)
END
GO
/****** Object:  StoredProcedure [dbo].[getLVL2TableID]    Script Date: 02/12/2014 11:35:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[getLVL2TableID]
	-- Add the parameters for the stored procedure here
	@statsType varchar(30), @aggregateType varchar(30), @admissionType varchar(30)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	select distinct tableID  from MetadataDPMTableAttributeValues 
	where TableId in ( 
		select distinct TableId from MetadataDPMTableAttributeValues 
		where TableId in (
			select MetadataDPMTables.TableId from 
			MetadataDPMTables inner join MetadataDPMTableAttributeValues on MetadataDPMTables.TableId = MetadataDPMTableAttributeValues.TableId 
			where TableAttributeId = 1 and TableAttributeValue=@statsType
			) 
		and TableAttributeId = 2 and TableAttributeValue=@aggregateType
		) 
	and TableAttributeId = 3 and TableAttributeValue = @admissionType
END
GO
/****** Object:  ForeignKey [FK_MetadataDPMTableAttributeValues_MetadataDPMTableAttributes]    Script Date: 02/12/2014 11:35:28 ******/
ALTER TABLE [dbo].[MetadataDPMTableAttributeValues]  WITH CHECK ADD  CONSTRAINT [FK_MetadataDPMTableAttributeValues_MetadataDPMTableAttributes] FOREIGN KEY([TableAttributeId])
REFERENCES [dbo].[MetadataDPMTableAttributes] ([TableAttributeId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[MetadataDPMTableAttributeValues] CHECK CONSTRAINT [FK_MetadataDPMTableAttributeValues_MetadataDPMTableAttributes]
GO
/****** Object:  ForeignKey [FK_MetadataDPMTableAttributeValues_MetaDPMdataTables]    Script Date: 02/12/2014 11:35:28 ******/
ALTER TABLE [dbo].[MetadataDPMTableAttributeValues]  WITH CHECK ADD  CONSTRAINT [FK_MetadataDPMTableAttributeValues_MetaDPMdataTables] FOREIGN KEY([TableId])
REFERENCES [dbo].[MetadataDPMTables] ([TableId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[MetadataDPMTableAttributeValues] CHECK CONSTRAINT [FK_MetadataDPMTableAttributeValues_MetaDPMdataTables]
GO
